import request from '@/utils/request'

// 查询家庭列表
export function listHome(query) {
  return request({
    url: '/system/home/list',
    method: 'get',
    params: query
  })
}

// 查询家庭位置列表
export function listHomePositionAndUser(query) {
  return request({
    url: '/system/home/listPosition',
    method: 'get',
    params: query
  })
}

export function listHomePosition(query) {

}

// 查询家庭详细
export function getHome(id) {
  return request({
    url: '/system/home/' + id,
    method: 'get'
  })
}

// 新增家庭
export function addHome(data) {
  return request({
    url: '/system/home',
    method: 'post',
    data: data
  })
}

// 修改家庭
export function updateHome(data) {
  return request({
    url: '/system/home',
    method: 'put',
    data: data
  })
}

// 删除家庭
export function delHome(id) {
  return request({
    url: '/system/home/' + id,
    method: 'delete'
  })
}

// 导出家庭
export function exportHome(query) {
  return request({
    url: '/system/home/export',
    method: 'get',
    params: query
  })
}

// 查询家庭详细
export function getHomeCount() {
  return request({
    url: '/system/home/getHomeCount',
    method: 'get'
  })
}

// 通过手机号和组织编码查询家庭
export function getHomeListByAccountAndOrgCode(query) {
  return request({
    url: '/system/home/getHomeByAccountAndOrgCode',
    method: 'get',
    params: query
  })
}

// 查询昨日新增用户量
export function getYesterdayRegisterCount() {
  return request({
    url: '/system/indexPageData/yesterdayRegisterCount',
    method: 'get'
  })
}

// 查询昨日活跃量
export function getYesterdayActiveCount() {
  return request({
    url: '/system/indexPageData/yesterdayActiveCount',
    method: 'get'
  })
}

// 查询接口访问量
export function getApiAccessCount() {
  return request({
    url: '/system/indexPageData/apiAccessCount',
    method: 'get'
  })
}

// 查询接口访问量
export function getProductInfoCount() {
  return request({
    url: '/system/indexPageData/productInfoCount',
    method: 'get'
  })
}

import Qs from 'qs'

// 查询接口访问量
export function updateHomeHotelOrderNum(query) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/system/home/updateHomeHotelOrderNum',
    method: 'put',
    data: Qs.stringify(query)
  })
}
